package cn.cstech.aijia.ui.base.fragments;

import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;

import cn.cstech.aijia.R;
import cn.cstech.aijia.ui.SettingActivity;
import cn.cstech.aijia.ui.base.BaseFragment;
import cn.cstech.aijia.ui.base.views.MineMenuItem;
import cn.cstech.aijia.ui.my.SystemMsgActivity;
import cn.cstech.aijia.ui.user.LoginActivity;

/**
 * Created with Android Studio.
 * Title:MineFragment
 * Description:
 * Copyright:Copyright (c) 2014
 * Company:中国平安健康保险有限公司
 * Author:Alice
 * Date:15/9/2
 * Time:下午5:24
 * Version 1.0
 */
public class MineFragment extends BaseFragment{
    private ImageView iv_head_icon;
    private MineMenuItem menu_wdfw;
    private MineMenuItem menu_tsfa;
    private MineMenuItem menu_wdsz;

    private MineMenuItem menu_order;
    private MineMenuItem menu_buy;
    @Override
    public View onCreateViewCustom(LayoutInflater inflater, ViewGroup container) {
        View view = inflater.inflate(R.layout.fg_mine, null);
        initViews(view);
        return view;
    }

    @Override
    public void onTitleBarCreate(){
        setTitleText("我的");
        setRightImageView(R.drawable.setting_icon, new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(getActivity(), SettingActivity.class);
                startActivity(intent);
            }
        });
    }

    private void initViews(View v){
        iv_head_icon = (ImageView)v.findViewById(R.id.iv_head_icon);
        menu_wdfw = (MineMenuItem)v.findViewById(R.id.menu_wdfw);
        menu_tsfa = (MineMenuItem)v.findViewById(R.id.menu_tsfa);
        menu_wdsz = (MineMenuItem)v.findViewById(R.id.menu_wdsz);

        menu_order = (MineMenuItem) v.findViewById(R.id.menu_order);
        menu_buy = (MineMenuItem) v.findViewById(R.id.menu_buy);


        menu_wdfw.initItem(R.drawable.icon_my_service,R.string.label_menu_wdfw,-1);
        menu_tsfa.initItem(R.drawable.icon_push_service,R.string.label_menu_tsfa,-1);
        menu_wdsz.initItem(R.drawable.icon_message,R.string.label_menu_wdsz,-1);

        menu_order.initItem(R.drawable.icon_coupon,R.string.label_menu_order,-1);
        menu_buy.initItem(R.drawable.icon_mycart,R.string.label_menu_buy,-1);


        menu_wdfw.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                gotoWdfw();
            }
        });

        menu_tsfa.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                gotoTsfa();
            }
        });

        menu_wdsz.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                gotoWdsz();
            }
        });
    }


    private void gotoWdfw(){

    }

    private void gotoTsfa(){

    }

    private void gotoWdsz(){

        startActivity(new Intent(getActivity(), SystemMsgActivity.class));
    }
}
